﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.Admin
{
    public partial class ShowJobs : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["jobsid"]))
                {
                    ShowInfo(Convert.ToInt32(Request["jobsid"]));
                }
            }
        }

        private void ShowInfo(int enterprise_rid)
        {
            lcmyjobs.BLL.enterprise_releasejob bll = new lcmyjobs.BLL.enterprise_releasejob();
            DataSet ds = bll.GetReleaseJob(enterprise_rid);

            DataTable dt_rj = ds.Tables[0];
            DataTable dt_area = ds.Tables[1];
            DataTable dt_major = ds.Tables[2];



            if (dt_rj.Rows.Count > 0)
            {
                this.lblname.Text = "【"+dt_rj.Rows[0]["name"]+"】招聘职位详细信息";

                this.txtjobclass.Text = dt_rj.Rows[0]["jobclass"].ToString();
                this.txtworkercount.Text = dt_rj.Rows[0]["workercount"].ToString();
                this.txtjobdep.Text = dt_rj.Rows[0]["jobdep"].ToString();
                this.txtjob.Text = dt_rj.Rows[0]["jobs_name"].ToString();

                this.txtsalarym.Text = lcmyjobs.BLL.Tools.GetSalary(dt_rj.Rows[0]["salarym"].ToString());//月薪

                if (!string.IsNullOrEmpty(dt_rj.Rows[0]["salaryy"].ToString()))//年薪
                {
                    this.txtsalaryy.Visible = true;
                    this.txtsalaryy.Text = "年薪："+ dt_rj.Rows[0]["salaryy"].ToString()+"万";
                }
                else
                {
                    this.txtsalaryy.Visible = false;
                }


                this.txtvalidity.Text = dt_rj.Rows[0]["validity"].ToString();

                if (dt_rj.Rows[0]["workerclass"].ToString() == "0")
                {
                    this.txtclass.Text = "不限";
                }
                if (dt_rj.Rows[0]["workerclass"].ToString() == "1")
                {
                    this.txtclass.Text = "往届生";
                }
                if (dt_rj.Rows[0]["workerclass"].ToString() == "2")
                {
                    this.txtclass.Text = "应届生";
                }

                this.txtedu.Text = lcmyjobs.BLL.Tools.GetEdu(dt_rj.Rows[0]["edus_id"].ToString());
                this.txtworkxp.Text = lcmyjobs.BLL.Tools.GetWorkxp(dt_rj.Rows[0]["workexp_id"].ToString());
                this.txtjobduty.Text = dt_rj.Rows[0]["jobduty"].ToString();
                this.txtjobrequirement.Text = dt_rj.Rows[0]["jobrequirement"].ToString();
                //this.txtreleasetime.Text = model.releasetime.ToString();
                //this.chkisuse.Checked = model.isuse;
                this.txtlan.Text = lcmyjobs.BLL.Tools.Getlanguage(dt_rj.Rows[0]["languages_id"].ToString());
                this.txtlevel.Text = lcmyjobs.BLL.Tools.Getlevel(dt_rj.Rows[0]["languages_level"].ToString());
                //this.txtbcount.Text = model.bcount.ToString();
               
                if (Convert.ToBoolean(dt_rj.Rows[0]["isfrist"]))//急聘
                {

                    this.cbo_isfrist.Visible = true;
                }
                else
                {
                    this.cbo_isfrist.Visible = false;
                }

                if (!string.IsNullOrEmpty(dt_rj.Rows[0]["price"].ToString()))//如果悬赏金额不为空
                {
                    this.cbo_isreward.Visible = true;
                    this.cbo_isreward.Text = "悬赏招聘" + "金额：" + dt_rj.Rows[0]["price"].ToString() + "元";
                }
                else
                {
                    this.cbo_isreward.Visible = false;
                }

            }

            if (dt_area.Rows.Count > 0)
            {
                string area_name = "";
                foreach (DataRow row in dt_area.Rows)
                {
                    area_name += row["area_name"].ToString() + ",";

                }

                this.txtarea.Text = area_name.Substring(0, area_name.Length - 1);
            }

            if (dt_major.Rows.Count > 0)
            {
                string major_name = "";
                foreach (DataRow row in dt_major.Rows)
                {
                    major_name += row["major_name"].ToString() + ",";

                }

                this.txtmajor.Text = major_name.Substring(0, major_name.Length - 1);
            }
            else
            {
                this.txtmajor.Text = "不限";
            }

        }
    }
}